<?php

/**
 * This is the model class for table "sptpd_galianc".
 *
 * The followings are the available columns in table 'sptpd_galianc':
 * @property string $id_transaksi
 * @property string $nomor_urut
 * @property string $npwpd
 * @property string $nomor_sptpd
 * @property string $masa_pajak
 * @property string $masa_pajak_terbilang
 * @property string $tanggal_awal_golc
 * @property string $tanggal_akhir_golc
 * @property string $thn_pajak_golc
 * @property string $tgl_sptpd_golc
 * @property string $kode_pajak
 * @property string $id_rekening
 * @property string $no_rekening
 * @property string $cara_hitung
 * @property double $tarip_pajak_golc
 * @property double $omzet_golc
 * @property double $bunga_golc
 * @property double $denda_golc
 * @property double $total_pajak_golc
 * @property string $tanggal_golc
 * @property string $status_tap_golc
 * @property string $status_bayar_golc
 * @property string $status_aktif_golc
 * @property string $keterangan_golc
 * @property string $nomor_kohir
 * @property string $sptpd_stat
 * @property string $user_operator
 * @property double $nilai_standart
 * @property double $tonase
 * @property integer $id_bahan_galian
 *
 * The followings are the available model relations:
 * @property BahanGalian $idBahanGalian
 * @property Pajak $kodePajak
 * @property DataNpwpd $nomorUrut
 * @property Rekening $idRekening
 */
class SptpdGalianc extends CActiveRecord
{
	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'sptpd_galianc';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('id_transaksi', 'required'),
			array('id_bahan_galian', 'numerical', 'integerOnly'=>true),
			array('tarip_pajak_golc, omzet_golc, bunga_golc, denda_golc, total_pajak_golc, nilai_standart, tonase', 'numerical'),
			array('id_transaksi, nomor_urut, nomor_kohir', 'length', 'max'=>15),
			array('npwpd, no_rekening', 'length', 'max'=>20),
			array('nomor_sptpd', 'length', 'max'=>25),
			array('masa_pajak, masa_pajak_terbilang', 'length', 'max'=>4),
			array('cara_hitung', 'length', 'max'=>5),
			array('status_tap_golc, status_bayar_golc, status_aktif_golc, sptpd_stat', 'length', 'max'=>2),
			array('user_operator', 'length', 'max'=>35),
			array('tanggal_awal_golc, tanggal_akhir_golc, thn_pajak_golc, tgl_sptpd_golc, kode_pajak, id_rekening, tanggal_golc, keterangan_golc', 'safe'),
			// The following rule is used by search().
			// @todo Please remove those attributes that should not be searched.
			array('id_transaksi, nomor_urut, npwpd, nomor_sptpd, masa_pajak, masa_pajak_terbilang, tanggal_awal_golc, tanggal_akhir_golc, thn_pajak_golc, tgl_sptpd_golc, kode_pajak, id_rekening, no_rekening, cara_hitung, tarip_pajak_golc, omzet_golc, bunga_golc, denda_golc, total_pajak_golc, tanggal_golc, status_tap_golc, status_bayar_golc, status_aktif_golc, keterangan_golc, nomor_kohir, sptpd_stat, user_operator, nilai_standart, tonase, id_bahan_galian', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'idBahanGalian' => array(self::BELONGS_TO, 'BahanGalian', 'id_bahan_galian'),
			'kodePajak' => array(self::BELONGS_TO, 'Pajak', 'kode_pajak'),
			'nomorUrut' => array(self::BELONGS_TO, 'DataNpwpd', 'nomor_urut'),
			'idRekening' => array(self::BELONGS_TO, 'Rekening', 'id_rekening'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id_transaksi' => 'Id Transaksi',
			'nomor_urut' => 'Nomor Urut',
			'npwpd' => 'Npwpd',
			'nomor_sptpd' => 'Nomor Sptpd',
			'masa_pajak' => 'Masa Pajak',
			'masa_pajak_terbilang' => 'Masa Pajak Terbilang',
			'tanggal_awal_golc' => 'Tanggal Awal Golc',
			'tanggal_akhir_golc' => 'Tanggal Akhir Golc',
			'thn_pajak_golc' => 'Thn Pajak Golc',
			'tgl_sptpd_golc' => 'Tgl Sptpd Golc',
			'kode_pajak' => 'Kode Pajak',
			'id_rekening' => 'Id Rekening',
			'no_rekening' => 'No Rekening',
			'cara_hitung' => 'Cara Hitung',
			'tarip_pajak_golc' => 'Tarip Pajak Golc',
			'omzet_golc' => 'Omzet Golc',
			'bunga_golc' => 'Bunga Golc',
			'denda_golc' => 'Denda Golc',
			'total_pajak_golc' => 'Total Pajak Golc',
			'tanggal_golc' => 'Tanggal Golc',
			'status_tap_golc' => 'Status Tap Golc',
			'status_bayar_golc' => 'Status Bayar Golc',
			'status_aktif_golc' => 'Status Aktif Golc',
			'keterangan_golc' => 'Keterangan Golc',
			'nomor_kohir' => 'Nomor Kohir',
			'sptpd_stat' => 'Sptpd Stat',
			'user_operator' => 'User Operator',
			'nilai_standart' => 'Nilai Standart',
			'tonase' => 'Tonase',
			'id_bahan_galian' => 'Id Bahan Galian',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 *
	 * Typical usecase:
	 * - Initialize the model fields with values from filter form.
	 * - Execute this method to get CActiveDataProvider instance which will filter
	 * models according to data in model fields.
	 * - Pass data provider to CGridView, CListView or any similar widget.
	 *
	 * @return CActiveDataProvider the data provider that can return the models
	 * based on the search/filter conditions.
	 */
	public function search()
	{
		// @todo Please modify the following code to remove attributes that should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id_transaksi',$this->id_transaksi,true);
		$criteria->compare('nomor_urut',$this->nomor_urut,true);
		$criteria->compare('npwpd',$this->npwpd,true);
		$criteria->compare('nomor_sptpd',$this->nomor_sptpd,true);
		$criteria->compare('masa_pajak',$this->masa_pajak,true);
		$criteria->compare('masa_pajak_terbilang',$this->masa_pajak_terbilang,true);
		$criteria->compare('tanggal_awal_golc',$this->tanggal_awal_golc,true);
		$criteria->compare('tanggal_akhir_golc',$this->tanggal_akhir_golc,true);
		$criteria->compare('thn_pajak_golc',$this->thn_pajak_golc,true);
		$criteria->compare('tgl_sptpd_golc',$this->tgl_sptpd_golc,true);
		$criteria->compare('kode_pajak',$this->kode_pajak,true);
		$criteria->compare('id_rekening',$this->id_rekening,true);
		$criteria->compare('no_rekening',$this->no_rekening,true);
		$criteria->compare('cara_hitung',$this->cara_hitung,true);
		$criteria->compare('tarip_pajak_golc',$this->tarip_pajak_golc);
		$criteria->compare('omzet_golc',$this->omzet_golc);
		$criteria->compare('bunga_golc',$this->bunga_golc);
		$criteria->compare('denda_golc',$this->denda_golc);
		$criteria->compare('total_pajak_golc',$this->total_pajak_golc);
		$criteria->compare('tanggal_golc',$this->tanggal_golc,true);
		$criteria->compare('status_tap_golc',$this->status_tap_golc,true);
		$criteria->compare('status_bayar_golc',$this->status_bayar_golc,true);
		$criteria->compare('status_aktif_golc',$this->status_aktif_golc,true);
		$criteria->compare('keterangan_golc',$this->keterangan_golc,true);
		$criteria->compare('nomor_kohir',$this->nomor_kohir,true);
		$criteria->compare('sptpd_stat',$this->sptpd_stat,true);
		$criteria->compare('user_operator',$this->user_operator,true);
		$criteria->compare('nilai_standart',$this->nilai_standart);
		$criteria->compare('tonase',$this->tonase);
		$criteria->compare('id_bahan_galian',$this->id_bahan_galian);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}

	/**
	 * Returns the static model of the specified AR class.
	 * Please note that you should have this exact method in all your CActiveRecord descendants!
	 * @param string $className active record class name.
	 * @return SptpdGalianc the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
}
